program Butterflys;

// Script Made by PerfectSkin.
//-----------------------------\\

// start from main menu


// Includes:
// Melee all four sides.
// Magic to lure monster.
// Healing when 3 hearts are lost.
// Will pickup labled drops *coming soon for more monsters*
// Auto-Login even when connection is lost it will continue to try and log on.
// A nifty report box telling u an estimated amount of butterflys and exp u have gotten.

var x,y,butterfly,
butterfly2,deadfly,
Button,Connection,
drops,counter,counter2: integer;
const
//
user = 'username';
pass = 'password';

//
monster = 16711935;
item = 16744448;

procedure typebyte(y:integer); //credit neo
Begin
  KeyDown(y);
  Wait(300 + Random(40));
  KeyUp(y);
End;

procedure Write (text: String); //credit neo
var writer: integer;
Begin
  For writer := 1 To Length(text) Do
  Begin
    TypeByte(GetKeyCode(text[writer]));
    Wait(50 + Random(50));
  End;
  Wait(200 + Random(500));
  TypeByte(13);
End;

procedure key(x:integer);
begin
keydown(x)
wait(100)
keyup(x)
end;

procedure walk;
begin
if counter2 >=2 then
begin
wait(500)
keydown(37)
wait(300)
keyup(37)
wait(1100)
keydown(39)
wait(300)
keyup(39)
end;
end;

procedure click(x,y: integer);
begin
movemouse(x,y);
wait(1);
clickmouse(x,y,true);
end;

procedure setmage;
begin
keydown(113)
wait(100)
keyup(113)
end;


procedure Log;
begin
if counter >= 5 then begin
writeln('!-----------PROGRESS--------------!')
writeln('   We have raped '+IntToStr(deadfly)+' butterflys.')
writeln('   Exp gained ' +IntToStr(deadfly*90)+'.')
writeln('   Script made by PerfectSkin.')
writeln('   We have found '+IntToStr(drops)+ ' drops.');
writeln('!---------------------------------!')
counter := 0;
end;
end;

procedure settings;
begin
wait(2000)
click(605,445)
wait(3000)
writeln('Modifying settings to auto.')
if not findcolor(x,y,13158600,467, 383,467, 383)
then
begin
wait(1000)
click(566, 387)
writeln('Turned ballons off.')
wait(500)
end;
if not findcolor(x,y,13158600,467, 401,467, 401)
then
begin
wait(1000)
click(567, 405)
writeln('Turned shadows off.')
wait(500)
end;
if not findcolor(x,y,13158600,467, 455,467, 455)
then
begin
wait(1000)
click(567, 459)
writeln('Turned interaction off.')
wait(500)
end;
if not findcolor(x,y,13158600,227, 455,227, 455)
then
begin
wait(1000)
click(327, 458)
writeln('Turned whispers on.')
wait(500)
end;
click(79, 444)
writeln('Settings ready to auto.')
writeln('Script Made by: PerfectSkin.')
wait(500)
end;

procedure logininfo;
begin
write(User)
key(9)
write(pass)

click(397, 426)


end;


procedure mainMenu2;
begin
if findcolor(x,y,16777215,34,99,34,99) and
findcolor(x,y,8092539,190, 322,190, 322) then
writeln('At the main Menu');
wait(1000)
repeat
click(115, 365)
if findbitmap(button,x,y) then
begin
writeln('Cant find server.')
click(x,y)
wait(2000)
end;
wait(1000)
until findcolor(x,y,6914725,428, 349,428, 349) and
findcolor(x,y,2710148,297, 348,297, 348)
click(411, 348);
wait(300);
writeln('Entering Info now');
Logininfo;
repeat
wait(100)
until findcolor(x,y,2183803,350, 107,350, 107) and
findcolor(x,y,1063250,436, 87,436, 87)
click(543, 131)
repeat
wait(100)
until findcolor(x,y,16235924,237, 31,237, 31)
writeln('We are Online');
settings;
end;

procedure doublelog;
begin
if findbitmap(button,x,y) then
begin
wait(100)
click(x,y)
wait(1000)
mainmenu2;
end;
end;

procedure mainMenu;
begin
if findcolor(x,y,16777215,34,99,34,99) and
findcolor(x,y,8092539,190, 322,190, 322) then
writeln('At the main Menu');
wait(1000)
repeat
click(115, 365)
if findbitmap(button,x,y) then
begin
writeln('Cant find server.')
click(x,y)
wait(2000)
end;
wait(1000)
until findcolor(x,y,6914725,428, 349,428, 349) and
findcolor(x,y,2710148,297, 348,297, 348)
click(411, 348);
wait(300);
writeln('Entering Info now');
Logininfo;
wait(3000)
doublelog;
repeat
wait(100)
until findcolor(x,y,2183803,350, 107,350, 107) and
findcolor(x,y,1063250,436, 87,436, 87)
click(543, 131)
repeat
wait(100)
until findcolor(x,y,16235924,237, 31,237, 31)
writeln('We are Online');
settings;
end;

procedure Keeplogin;
begin
if findbitmap(Connection,x,y) then
begin
findbitmap(Button,x,y)
wait(1000)
click(x,y)
writeln('We have lost connection to the game.');
wait(1000)
writeln('Now attempting to log back in with account info.');
mainmenu;
end;
end;

procedure attackMage;
begin
if not findcolor(x,y,monster,46, 58,609, 314) then
begin
walk;
repeat
keeplogin;
wait(50);
until findcolor(x,y,monster,46, 58,609, 314)
end;
if findcolor(x,y,monster,46, 58,609, 314) then
setmage;
wait(200)
click(x,y);
end;

procedure rightattack;
begin
if findbitmapin(butterfly,x,y,341, 146,356, 157) then
begin
key(39)
repeat
keeplogin;
key(17)
until not findbitmapin(butterfly,x,y,341, 146,356, 157)
end;
end;

procedure Leftattack;
begin
if findbitmapin(butterfly2,x,y,281, 116,298, 131) then
begin

key(37)
repeat
keeplogin;
key(17)
until not findbitmapin(butterfly2,x,y,281, 116,298, 131)
end;
end;

procedure Upattack;
begin
if findbitmapin(butterfly,x,y,340, 116,362, 131) then
begin
key(38)
repeat
keeplogin;
key(17)
until not findbitmapin(butterfly,x,y,340, 116,362, 131)
end;
end;

procedure Downattack;
begin
if findbitmapin(butterfly2,x,y,280, 143,310, 163) then
begin
key(40)
repeat
keeplogin;
key(17)
until not findbitmapin(butterfly2,x,y,280, 143,310, 163)
end;
end;

procedure drop;
begin
if not findcolor(x,y,item,244,144,389,220) then
begin
end;
if findcolor(x,y,item,244,144,389,220) then
begin
wait(100);
movemouse(x,y);
wait(1000)
if findcolor(x,y,14803425,240,115,408, 216) and
findcolor(x,y,item,244,144,389,220) then
drops := drops+1;
findcolor(x,y,item,244,144,389,220)
clickmouse(x,y,true)
wait(1000)
end;
end;


procedure melee;
begin
wait(2000);
if findbitmapin(butterfly2,x,y,280, 143,310, 163) then
begin
wait(300);
Downattack;
deadfly := deadfly+1;
counter := counter+1;
counter2 := counter2+1;
log;
drop;
end;
if findbitmapin(butterfly,x,y,340, 116,362, 131) then
begin
wait(300);
Upattack;
deadfly := deadfly+1;
counter := counter+1;
counter2 := counter2+1;
log;
drop;
end;
if findbitmapin(butterfly2,x,y,281, 116,298, 131) then
begin
wait(300);
Leftattack;
deadfly := deadfly+1;
counter := counter+1;
counter2 := counter2+1;
log;
drop;
end;
if findbitmapin(butterfly,x,y,341, 146,356, 157) then
begin
wait(300);
Rightattack;
deadfly := deadfly+1;
counter := counter+1;
counter2 := counter2+1;
log;
drop;
end;
end;

procedure heal;
begin
if findcolor(x,y,1579032,184, 32,184, 32) then
begin
repeat
keeplogin;
key(112)
until findcolor(x,y,9728941,200, 33,200, 33)
 end;
end;

procedure LoadBits;
begin
Button := BitmapFromString(3, 4, 'beNqbk+1kqXntWAsQFWd7QRhr52S' +
       'f29uydW3xuWMt5/ZWrwUAeqkVtw==');

connection := BitmapFromString(18, 13, 'beNptkC0WhDAMhK+wsj' +
       'ayR8AiI5FrKysjsZxxj8A5NtOB/lDe+0QZptNJNO6bOOf54wEoP4M' +
       'z6FvTTUH/18/OMaddIeGRQ7q/odch6vN1prVi2mWWPrY2oIyP1mLu' +
       'zMvHKTbhLGRu6OQrUIpZkK+tCf1ZxW10IqeYh4YTRv+rBwlhnFrYv' +
       'OoH9fJ5VFt3ax5/JFoZsx/f3ncu+zfCr5JWjFk9Ni6WDY1bug/uT0' +
       'vgLer5HrwqvgpPRrjGvLblJ43YP0JAUoBbW8zOH793DDc=');

butterfly := BitmapFromString(2, 2, 'beNpjaPjP0MDwH0j+/w8AIvUGfA=' +
       '=');

butterfly2 := BitmapFromString(2, 2, 'beNpj+M/wv+E/AxgBACdsBnw=');

end;



begin
ActivateClient;
deadfly := 0;
counter2 :=0;
counter := 0;
LoadBits;
mainMenu;
writeln('Starting script hoe!.');
repeat
heal;
melee;
attackMage;
Keeplogin;
until false
end.
